package com.test3;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/****
 *  创建一个定长线程池，支持定时及周期性任务执行。
 *
 */
public class ScheduledThreadPoolTest {
	public static void main(String[] args) {
		ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(5);
		newScheduledThreadPool.schedule(new Runnable() {
			public void run() {
					System.out.println("delay 3 seconds");
			}
		}, 3, TimeUnit.SECONDS);
	}
}
